package top.moxingwang.javawork.lock;

public class ServiceA {
    public synchronized void print(int s){
        System.out.println("开始print" + Thread.currentThread().getId());
        try {
            Thread.sleep(s);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("结束开始print"+ Thread.currentThread().getId());
    }

    public  void say(int s){
        System.out.println("开始say" + Thread.currentThread().getId());
        try {
            Thread.sleep(s);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("结束开始say"+ Thread.currentThread().getId());
    }
}
